package com.xiaoquan.gulimall.gateway.config;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

import java.net.URI;

/**
 * @authro dxq
 * @date 2021年07月05日 23:35
 */
@Component
public class SimpleFilter implements GlobalFilter {
    // 监听器 可以监听每次请求的url地址  然后可以判断是哪里出了问题 请求地址有没有请求到网关........
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        URI uri = exchange.getRequest().getURI();
        System.out.println("请求的url地址："+uri);
        return chain.filter(exchange);
    }

}
